import ContextTodo from "../../../../store/contextTodo";
import { useContext } from 'react';
const ContextChild2= () => {
  const context = useContext(ContextTodo)

    return (<div>
       拿到全局共享的todo数据：
       
       <ContextTodo.Consumer>
          {
            value => <p>全局拿到的title:{value.title}</p>
          }
       </ContextTodo.Consumer>
       <button onClick={() => context.updateList({title: '哈哈哈11', level: 2})}>添加一條todo</button>
    </div>);
}
 
export default ContextChild2;